module XpmRoutine

using XpmParser
using CSV
using Utils

function xpm_functions(xpm::XPM, xpmfilename::String)
    while true
        println(h("\n                    ************ XPM functions ************", fc="c"))
        println("-2 Preview XPM data in fig")
        println("-1 Show XPM data")
        println(" 0 Return to main menu")
        println(" 1 Convert to .csv file")
        i = sel_fun(Int32)
        if i == 0
            return
        elseif i == -1
            println(xpm)
        elseif i == 1
            request_hint("Convert ss symbol (~, E, B, T, H, etc.) to discription labels (Coil, B-Sheet, B-Bridge, Turn, A-Helix, etc.)? [Y/n] ")
            if get_input("y") != "n"
                convert_ss_table!(xpm)
            end
            path = get_path(xpmfilename, false, "csv")
            xpm2csv(xpm, path)
            finish_path(path)
        end
    end
end

end